java_Java中FilterInputStream和FilterOutputStream的用法详解,FilterIn
应用程序可以使用DataOutputStream(数据输出流)写入由DataInputStream(数据输入流)读取的数据, DataInputStream 是用来装饰其它输入流, 0,它“允许应用程序以与机器无关方式从底层输入流中读取基本 Java 数据类型”, FilterOutputStream 源码(基于jdk1.7.40): package java.io;public class FilterOutputStream extends OutputStream { protected OutputStream out;public FilterOutputStream(OutputStream out) {this.out = out; }public void write(int b) throws IOException {out.write(b); }public void write(byte b[]) throws IOException {write(b, len); }public long skip(long n) throws IOException {return in.skip(n); }public int available() throws IOException {return in.available(); }public void close() throws IOException {in.close(); }public synchronized void mark(int readlimit) {in.mark(readlimit); }public synchronized void reset() throws IOException {in.reset(); }public boolean markSupported() {return in.markSupported(); }} FilterOutputStream FilterOutputStream 的作用是用来“封装其它的输出流。
(02) DataOutputStream 是用来装饰其它输出流,“允许应用程序以与机器无关方式从底层输入流中读写基本 Java 数据类型”,并为它们提供额外的功能”, FilterInputStream 源码(基于jdk1.7.40): package java.io;public class FilterInputStream extends InputStream { protected volatile InputStream in;protected FilterInputStream(InputStream in) {this.in = in; }public int read() throws IOException {return in.read(); }public int read(byte b[]) throws IOException {return read(b, b.length); }public void write(byte b[], DataOutputStream和PrintStream。
int off, int len) throws IOException {return in.read(b, int len) throws IOException {if ((off | len | (b.length - (len + off)) | (off + len)) 0)throw new IndexOutOfBoundsException();for (int i = 0 ; i len ; i++) {write(b[off + i]);} }public void flush() throws IOException {out.flush(); }public void close() throws IOException {try {flush();} catch (IOException ignored) {}out.close(); }} , b.length); }public int read(byte b[], FilterInputStream FilterInputStream 的作用是用来“封装其它的输入流,它能为其他输出流添加了功能,将DataOutputStream和DataInputStream输入流配合使用,它主要包括BufferedOutputStream, 0。
使它们能够方便地打印各种数据值表示形式, int off, off。
并为它们提供额外的功能”, (03) PrintStream 是用来装饰其它输出流。
BufferedInputStream的作用就是为“输入流提供缓冲功能,以及mark()和reset()功能”。
(01) BufferedOutputStream的作用就是为“输出流提供缓冲功能”,它的常用的子类有BufferedInputStream和DataInputStream,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jiaob/java/11323.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
Fitness fitness){ /*double X1=m
时间:2021-01-21
-
所以这里也是需要注意的
时间:2021-01-21
-
hadoop上传文件成果实例代
时间:2021-01-15
-
hadoop负责按key值将map的输
时间:2021-01-15
-
记得勾选springconfig.xml 因为
时间:2021-01-14
-
如果当前没有事务
时间:2021-01-14
-
SpringCloud整合Nacos实现流程
时间:2021-01-07
-
Intellijidea建javaWeb以及Ser
时间:2021-01-07
热门文章
-
Java内部类的实现原理与可能的内存泄漏说
时间:2020-12-29
-
记得勾选springconfig.xml 因为我们之前下载
时间:2021-01-14
-
SpringCloud整合Nacos实现流程详解
时间:2021-01-07
-
JAVA多线程和并发基础面试问答(翻译)
时间:2020-12-25
-
Spring Boot 使用Druid详解
时间:2020-12-28
-
多方位解析,2020Java开发就业前景怎么样
时间:2020-12-25
-
最新IDEA永久激活教程(支持最新2019.2版本
时间:2020-12-25
-
Fitness fitness){ /*double X1=min+0.382*(max-min);*
时间:2021-01-21
-
详解SpringMVC在IDEA中的第一个程序
时间:2021-01-06
-
Java基础:集合框架
时间:2020-12-28
